package com.googlecode.imanager.client.style;

import com.googlecode.imanager.client.util.NameSpace;


/**
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
public class StandardTheme extends Theme {

    private static final long serialVersionUID = 1L;

    private static StandardTheme instance;

    public StandardTheme() {
        
        Style controlStyle = new Style();
        controlStyle.setFont(new Font(
                "Arial", 8, Color.BLACK, false, false, false, false, 
                HorzAlignment.LEFT, VertAlignment.MIDDLE));
        controlStyle.setBackground(new Background(Color.WHITE));        
        setStyle(controlStyle, NameSpace.CONTROL);
        
        Style containerStyle = new Style();
        containerStyle.setBackground(new Background(Color.TRANSPARENT));
        setStyle(containerStyle, NameSpace.CONTAINER);
        
        Style table = new Style();
        table.setBackground(new Background(Color.WHITE));
        setStyle(table, NameSpace.TABLE);

        Style tableRow = new Style();
        tableRow.setBorder(Border.EMPTY_BORDER);
        tableRow.setBorderBottom(new Border(Color.LIGHT_GRAY, 1));
        setStyle(tableRow, NameSpace.TABLE_ROW);

        Style document = new Style();
        document.setBackground(new Background(Color.LIGHT_GRAY)); // 0xece9d8
        setStyle(document, NameSpace.DOCUMENT);
        
        Style panelStyle = new Style();
        panelStyle.setBorderLeft(new Border(Color.valueOf(0xece9d8), 2));
        panelStyle.setBorderRight(new Border(Color.valueOf(0xaca899), 2));
        panelStyle.setBorderTop(panelStyle.getBorderLeft());
        panelStyle.setBorderBottom(panelStyle.getBorderRight());
        setStyle(panelStyle, NameSpace.PANEL);
        
        Style inputControl = new Style();
        inputControl.setBorder(new Border(Color.valueOf(0x7f9db9)));
        setStyle(inputControl, NameSpace.INPUT_CONTROL);
        
        setStyle(inputControl.clone(), NameSpace.BUTTON);

        setStyle(inputControl.clone(), NameSpace.PICTURE);
        
        Style labelStyle = new Style();
        labelStyle.setFont(new Font(true, null, null, null));
        labelStyle.setBackground(new Background(Color.TRANSPARENT));
        setStyle(labelStyle, NameSpace.LABEL);        
    }

    public static StandardTheme getInstance() {
        if (instance == null){
            instance = new StandardTheme();
        }
        return instance;
    }
    
    @Override
    public String toString() {
        return "StandardTheme";
    }
    
}
